Python Data Analysis, Third Edition by Unknown

Python Data Analysis, Third Edition by Unknown
Author: Unknown
Language: eng
Format: epub
Published: 2021-01-08

In the preceding example, we filtered employees on the basis of their performance score (performance_score >=700). Now, let's filter data using multiple conditions:

# Filter employee who has more than 500 and less than 700 performance score

data[(data.performance_score >=500) & (data.performance_score < 700)]

This results in the following output:

We can also try the query() method. This method queries the columns using a boolean expression. Let's look at an example:

# Filter employee who has performance score of less than 500

data.query('performance_score<500')

This results in the following output: